package org.jpush.core;

/**
 * This class contains all the options for a <code>Listener</code>
 * 
 * @author Lei Wang
 *
 */
public class ListenerOptions
{
	private String interfaceAddress;

    private int listeningBackLog;
    private boolean isTcpNoDelay;
    private boolean synAttackPrevention;

    private Protocol protocol;

//    public int readBufferSize;
//    public int sendBufferSize;

    private int intermediateSendBufferSize;
    private int intermediateReceiveBufferSize;

    public ListenerOptions()
    {
        interfaceAddress = null;
        listeningBackLog = 100;
        isTcpNoDelay = true;
        synAttackPrevention = false;
        protocol = null;
        //readBufferSize = 8192;
        //sendBufferSize = 8192;

        intermediateReceiveBufferSize = 8192 * 2;
        intermediateSendBufferSize = 8192 * 3;
    }
    
    public String getInterfaceAddress()
    {
    	return this.interfaceAddress;
    }
    
    public int getListeningBackLog()
    {
    	return this.listeningBackLog;
    }
    
    public boolean isTcpNoDelay()
    {
    	return this.isTcpNoDelay;
    }
    
    public boolean synAttackPrevention()
    {
    	return this.synAttackPrevention;
    }
    
    public int getIntermediateSendBufferSize()
    {
    	return this.intermediateSendBufferSize;
    }
    
    public int getIntermediateReceiveBufferSize()
    {
    	return this.intermediateReceiveBufferSize;
    }
    
    public Protocol getProtocol()
    {
    	return this.protocol;
    }
    
    public void setInterfaceAddress(String interfaceAddress)
    {
    	this.interfaceAddress = interfaceAddress;
    }
    
    public void setListeningBackLog(int listeningBackLog)
    {
    	this.listeningBackLog = listeningBackLog;
    }
    
    public void setIsTcpNoDelay(boolean isTcpNoDelay)
    {
    	this.isTcpNoDelay = isTcpNoDelay;
    }
    
    public void setSynAttackPrevention(boolean synAttackPrevention)
    {
    	this.synAttackPrevention = synAttackPrevention;
    }
    
    public void setIntermediateSendBufferSize(int intermediateSendBufferSize)
    {
    	this.intermediateSendBufferSize = intermediateSendBufferSize;
    }
    
    public void setIntermediateReceiveBufferSize(int intermediateReceiveBufferSize)
    {
    	this.intermediateReceiveBufferSize = intermediateReceiveBufferSize;
    }
    
    public void setProtocol(Protocol protocol)
    {
    	this.protocol = protocol;
    }
}
